home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Megahits 3
/
Megahits 3 (1994)(GTI - Rhein-Main-Soft)(DE)[!].iso
/
module
/
utilities
/
modinfo
/
modinfo.s
< prev
Wrap
Text File
|
1994-10-14
|
30KB
|
1,125 lines
**********************************************************************
** program : ModInfo **
** version : 1.2 **
** author : Gunther Nikl **
** language : Devpac 2.14 (assembler) **
** bugs : none known **
**********************************************************************
** **
** History **
** ------- **
** v0.1 28-09-92 first simple version, module had to be "incbined" **
** in the program **
** v1.0 01-10-92 support of commandline parsing with up to 10 args **
** (needs only 112 bytes + Kickstart 2.0 compatible) **
** can be made resident ( local data on the stack ) **
** abort possible with control-c **
** recognizes only modules with 31 samples **
** added powerpacker support to decrunch packed mods **
** for processing **
** help text if a '?' is found **
** error messages if something goes wrong **
** v1.1 07-10-92 start from workbench possible **
** file select with filerequester from req.library **
** if started without args or from workbench ( max. **
** 10 files selectable ) **
** switch -d added to state a default directory for **
** the filerequester ( switch and dirname can be **
** seperated with white spaces, but not nessecary ) **
** v1.2 09-10-92 sets now directory delivered by wa_Lock from **
** workbench message **
** added recognition abilities for old soundtracker **
** module (15 samples) and for startrekker 4 voices **
** **
**********************************************************************
opt o+,w- ; optimize, no warnings
_LVOForbid equ -132
_LVOAllocMem equ -198
_LVOFreeMem equ -210
_LVOSetSignal equ -306
_LVOGetMsg equ -372
_LVOReplyMsg equ -378
_LVOWaitPort equ -384
_LVOCloseLibrary equ -414
_LVORawDoFmt equ -522
_LVOOpenLibrary equ -552
_LVOOpen equ -30
_LVOClose equ -36
_LVORead equ -42
_LVOWrite equ -48
_LVOOutput equ -60
_LVOSeek equ -66
_LVOCurrentDir equ -126
_LVOFileRequest equ -84
_LVOPurgeFiles equ -114
ADDSTR macro
dc.w \1.str-StringTab
\1 equ StrCount
StrCount set \1+1
endm
bp equr a5
gb_SysBase equ -0 ; L ; ueberschreibt Original A5 !!!!
gb_DosBase equ -4 ; L
gb_WbMsg equ -8 ; L
gb_StdOut equ -12 ; L
gb_ModDif equ -14 ; W
gb_FlagLF equ -15 ; B
gb_ArgC equ -16 ; B
gb_ArgV equ -56 ; L*10
gb_FileSize equ -60 ; L
gb_FileBuf equ -64 ; L
gb_ModPtr equ -68 ; L
gb_FileLen equ -72 ; L
gb_FileNames equ -76 ; L
gb_EfxTab equ -108 ; W*16
gb_FxeTab equ -140 ; W*16
gb_FileReq equ -496 ; B*356
gb_StringBuf equ -908 ; B*412
gb_PrintBuf equ -1336 ; B*428
gb_CheckBuf equ -1336 ; B*1084
gb_SIZEOF equ -1336
start link bp,#gb_SIZEOF ; Platz fuer Vars schaffen
move.l d0,d2 ; Argumentlaenge sichern
move.l a0,a2 ; Argumentzeile sichern
move.l #(~gb_SIZEOF>>2),d1
move.l bp,a1
.clear clr.l -(a1) ; Variablenbereich loeschen
dbra d1,.clear
move.l 4.w,a6
move.l a6,gb_SysBase(bp) ; ExecBase sichern
move.l 276(a6),a4 ; SysBase->ThisTask
move.l 184(a4),d4 ; pr_WindowPtr
moveq #-1,d0
move.l d0,184(a4) ; keine DOS-Requester
tst.l 172(a4)
bne.s fromCLI ; CLI-Start
fromWB lea 92(a4),a0
jsr _LVOWaitPort(a6)
lea 92(a4),a0
jsr _LVOGetMsg(a6)
move.l d0,gb_WbMsg(bp) ; WB-Message
bsr OpenDOS
beq.s exit2 ; kein DOS
move.l gb_WbMsg(bp),a1
move.l 36(a1),a1
move.l (a1),d1
move.l gb_DosBase(bp),a6
jsr _LVOCurrentDir(a6) ; aktuelles Directory setzen
lea ConName.str(pc),a1
move.l a1,d1
move.l #1005,d2 ; MODE_OLDFILE
jsr _LVOOpen(a6)
move.l d0,160(a4) ; pr_COS -> Window Handle
beq.s exit2 ; Fehler
bsr.s main
moveq #Return,d0 ; "Press RETURN !"
bsr PrintStr
move.l 160(a4),d1 ; pr_COS
lea gb_PrintBuf(bp),a0
move.l a0,d2
moveq #1,d3
move.l gb_DosBase(bp),a6
jsr _LVORead(a6) ; ein Zeichen lesen
move.l 160(a4),d1
jsr _LVOClose(a6) ; Fenster schliessen
move.l gb_SysBase(bp),a6
exit2 jsr _LVOForbid(a6)
move.l gb_WbMsg(bp),a1
jsr _LVOReplyMsg(a6) ; WB-Message beantworten
bra.s exit ; zum Hauptprogramm
fromCLI clr.b -1(a2,d2.w) ; Zeile terminieren
bsr.s OpenDOS
beq.s exit ; kein DOS
move.l a2,a1
lea gb_ArgV(bp),a2
moveq #0,d2
bsr BuildArgV ; Argument-Vektor aufbauen
move.b d2,gb_ArgC(bp) ; Argumentzahl sichern
bsr.s main ; Hauptprogramm
exit bsr.s CloseDOS
move.l d4,184(a4) ; alten WindowPtr setzen
moveq #0,d0 ; ReturnCode = Alles Ok
unlk bp ; Stack aufraeumen
rts
OpenDOS lea DosName(pc),a1 ; dos.library
moveq #33,d0
jsr _LVOOpenLibrary(a6) ; DOS oeffen
move.l d0,gb_DosBase(bp) ; sichern -> Flags stellen
rts
CloseDOS move.l gb_DosBase(bp),d0 ; DOS geoeffnet ?
beq.s .quit ; nein
move.l d0,a1
jsr _LVOCloseLibrary(a6) ; DOS schliessen
.quit rts
*****************************************************************************
main movem.l d2/a2-3/a6,-(sp)
move.l gb_SysBase(bp),a6 ; ExecBase
moveq #PrgName,d0
bsr PrintStr2 ; Copyright ausgeben
lea gb_ArgV(bp),a2 ; Argumentvektor
move.l (a2),a0 ; 1. Argument
move.b gb_ArgC(bp),d2 ; Parameter ?
beq.s m_request2 ; FileRequester bringen
cmp.b #'?',(a0)
bne.s m_request ; ist Filename
m_use moveq #Usage,d0
bsr PrintStr ; Usage ausgeben
bra.s m_quit
m_request move.b (a0)+,d0 ; erstes Zeichen
rol.w #8,d0
move.b (a0)+,d0 ; zweites Zeichen
bset #5,d0
cmp.w #'-d',d0
bne.s m_loop ; kein Standard Directory
tst.b (a0)
bne.s .onlyone ; Name direkt angeschlossen
move.l 4(a2),d0
beq.s m_use ; Fehler -d ohne Argument !
move.l d0,a0
.onlyone lea gb_StringBuf(bp),a1
moveq #127,d0
.copy move.b (a0)+,(a1)+ ; DirName kopieren
dbeq d0,.copy
m_request2 bsr.s ReqFiles ; Files waehlen ( max. 10 )
bne.s m_quit ; Abbruch oder Fehler
move.b gb_ArgC(bp),d2
m_loop move.l (a2)+,a0 ; Argument holen
bsr LoadFile ; File laden
beq.s m_calc ; alles ok
subq.l #5,d0 ; Speicherfehler ?
beq.s m_quit ; ja !
bra.s m_cont
m_calc bsr DoCalc ; Effekte zaehlen & augeben
m_cont move.l gb_FileBuf(bp),d0
beq.s m_cont2 ; kein Puffer da
move.l d0,a1
move.l gb_FileSize(bp),d0 ; Puffergroesse
jsr _LVOFreeMem(a6) ; Puffer freigeben
clr.l gb_FileBuf(bp) ; Zeiger loeschen
m_cont2 bsr.s ChkBreak ; Break-Check
bne.s m_quit
subq.b #1,d2 ; noch Argumente
bne.s m_loop ; ja
m_quit move.l gb_FileNames(bp),d0 ; Puffer fuer Filenamen ?
beq.s .quit
move.l d0,a1
move.l gb_FileLen(bp),d0 ; Pufferlaenge
jsr _LVOFreeMem(a6) ; Speicher freigeben
.quit movem.l (sp)+,d2/a2-3/a6
rts ; Auf Wiedersehen !
ChkBreak moveq #0,d0
move #0,d1
jsr _LVOSetSignal(a6) ; gesetzte Signale holen
btst #12,d0
beq.s .quit ; kein CTRL-C
moveq #Break,d0
bsr PrintStr ; Abbruch-Meldung
moveq #1,d0
.quit rts
*****************************************************************************
ReqFiles movem.l d2-3/a2-4/a6,-(sp)
moveq #ReqNeed,d3 ; REQ-Fehler
lea ReqName(pc),a1
moveq #0,d0
move.l gb_SysBase(bp),a6
jsr _LVOOpenLibrary(a6) ; Lib oeffen
move.l d0,a4
move.l a4,d0
beq .quit ; kein REQ
moveq #LoadErr,d3 ; REQ-Abbruch
lea gb_FileReq(bp),a0 ; Request-Struktur
lea ReqTitle.str(pc),a1
move.l a1,2(a0) ; Requester Titel
lea gb_StringBuf(bp),a1
move.l a1,6(a0) ; DirName
lea gb_StringBuf+132(bp),a1
move.l a1,14(a0) ; PathName
move.w #10,22(a0) ; MaxExtSelect
move.l #4118,30(a0) ; ExtSel,Cache,IBut & Load
moveq #2,d0
move.w d0,34(a0) ; DirNameColour
move.w d0,38(a0) ; DevNameColour
move.l a4,a6
jsr _LVOFileRequest(a6) ; Fragen wat nu ...
tst.l d0
beq .purge ; nichts ausgewaehlt
.one move.l gb_FileReq+116(bp),d0 ; mehrere Files ?
bne.s .multi
move.l gb_FileReq+14(bp),a0 ; PathName
moveq #-1,d0
.flen tst.b (a0)+
dbeq d0,.flen
not.l d0 ; Speicherbedarf
bsr AllocFN
beq .purge
move.b #1,gb_ArgC(bp) ; 1 Argument
move.l d0,gb_ArgV(bp) ; Adresse des Arguments
move.l gb_FileReq+14(bp),a1
.copy move.b (a1)+,(a0)+ ; PathName kopieren
bne.s .copy
bra.s .allok
.multi moveq #-2,d2 ; mindestens ein Byte lang
move.l gb_FileReq+6(bp),a0
.dlen tst.b (a0)+
dbeq d2,.dlen
not.l d2 ; DirSize
move.l d0,a1 ; ExtendedSelect
moveq #0,d0
.count addq.w #1,d0 ; Argumentzahl erhoehen
move.l (a1),d1
move.l d1,a1
bne.s .count ; weitere Namen
move.b d0,gb_ArgC(bp) ; Argumentzahl
mulu d0,d2 ; DirSize*Fileanzahl
lsl.w #5,d0 ; Fileanzahl*32
add.w d2,d0 ; Speichergroesse
bsr.s AllocFN
beq.s .purge ; kein Speicher
move.l gb_FileReq+116(bp),a2 ; ExtendedSelect
lea gb_ArgV(bp),a3 ; Argument-Vektor
.copy2 move.l a0,(a3)+ ; Adresse nach ArgV
move.l gb_FileReq+6(bp),a1
tst.b (a1)
beq.s 2$ ; kein Pfadname
1$ move.b (a1)+,(a0)+ ; Pfadname kopieren
bne.s 1$
subq.w #2,a0
cmp.b #':',(a0)+
beq.s 2$ ; Devicekennung da
moveq #'/',d0
cmp.b -1(a0),d0
beq.s 2$ ; Pfadkennung vorhanden
move.b d0,(a0)+ ; Pfadkennung eintragen
2$ move.w 4(a2),d0 ; Laenge des Dateinamen
lea 12(a2),a1
bra.s 4$
3$ move.b (a1)+,(a0)+ ; Name kopieren
4$ dbra d0,3$
clr.b (a0)+ ; String terminieren
move.l (a2),d2
move.l d2,a2
bne.s .copy2 ; weitere Files
.allok moveq #0,d3 ; alles ok
.purge lea gb_FileReq(bp),a0 ; dem Request assoziierte
move.l a4,a6
jsr _LVOPurgeFiles(a6) ; Speicherbereiche freigeben
move.l a4,a1
move.l gb_SysBase(bp),a6
jsr _LVOCloseLibrary(a6) ; REQ schliessen
.quit move.l d3,d0 ; Fehler aufgetreten
beq.s .quit2
lea ReqName(pc),a1
bsr PrintStr ; Meldung ausgeben
move.l d3,d0 ; Flags wieder stellen
.quit2 movem.l (sp)+,d2-3/a2-4/a6
rts
AllocFN moveq #MemErr,d3 ; Speicherfehler
move.l d0,gb_FileLen(bp) ; Speicherbedarf
moveq #1,d1 ; Public Memory
move.l gb_SysBase(bp),a6
jsr _LVOAllocMem(a6)
move.l d0,a0
move.l d0,gb_FileNames(bp) ; Ptr eintragen
rts
*****************************************************************************
LoadFile movem.l d2-7/a2-3/a6,-(sp)
lea gb_CheckBuf(bp),a2
move.l a0,a3 ; Name sichern
move.l gb_DosBase(bp),a6
move.l a2,a1
.copy move.b (a0)+,(a1)+ ; Filenamen kopieren
bne.s .copy
moveq #FileErr,d7 ; File-Fehler
move.l a2,d1
move.l #1005,d2
jsr _LVOOpen(a6) ; Datei öffnen
move.l d0,d4
beq .quit2 ; File nicht gefunden
moveq #ModErr,d7 ; kein Modul
move.l d4,d1
move.l a2,d2
move.l #1084,d3
jsr _LVORead(a6) ; 1084 Bytes lesen
cmp.l d0,d3
bne .closef ; zu klein ( <1084 )
move.l (a2),d6 ; erste 4 Bytes der Datei
moveq #ReadErr,d7 ; Lesefehler
move.l d4,d1
moveq #-4,d2
moveq #1,d3 ; OFFSET_END
jsr _LVOSeek(a6) ; zum Dateiende-4
tst.l d0
bmi.s .closef ; Seekfehler
move.l d4,d1
move.l a2,d2
moveq #4,d3
jsr _LVORead(a6) ; 4 Bytes lesen
cmp.l d0,d3
bne.s .closef ; Lesefehler
move.l d4,d1
moveq #0,d2
moveq #-1,d3 ; OFFSET_BEGINNING
jsr _LVOSeek(a6) ; zum Dateianfang
move.l d0,d3 ; Wert sichern
bmi.s .closef ; Seekfehler
exg.l d2,d6 ; Null nach D6
cmp.l #'PP20',d2 ; PowerPacked ?
bne.s .notpp
move.l (a2),d6 ; richtige Laenge
lsr.l #8,d6 ; extrahieren
moveq #16,d0 ; 16 Bytes als
add.l d0,d6 ; Sicherheit dazu
.notpp exg.l d3,d6
tst.l d3
bne.s .ok ; D6 <> 0 -> gepacket !
exg.l d3,d6 ; Abstand zurueck nach d0
bsr.s ModCheck ; Modul prüfen
bne.s .closef ; nein
move.l #66620,d0
cmp.l d3,d0 ; Abstand > 66620 ?
bcc.s .ok ; nein
move.l d0,d3
.ok move.l d3,gb_FileSize(bp) ; Puffergroesse
moveq #MemErr,d7 ; Speicher-Fehler
move.l d3,d0 ; Speichergroesse
moveq #1,d1
move.l gb_SysBase(bp),a6
jsr _LVOAllocMem(a6) ; Puffer allokieren
move.l d0,gb_FileBuf(bp)
move.l gb_DosBase(bp),a6
beq.s .closef ; kein Speicher
move.l d0,gb_ModPtr(bp) ; if PP -> FileBuf <> ModPtr!
moveq #ReadErr,d7 ; Lese-Fehler
move.l d4,d1
move.l gb_FileBuf(bp),d2
tst.l d6 ; gepackte Laenge ( <>0 )
beq.s .read
move.l d6,d3 ; powerpacked
.read jsr _LVORead(a6) ; Header & Pattern einlesen
cmp.l d0,d3
bne.s .closef ; Lesefehler
moveq #0,d7 ; kein Fehler
.closef move.l d4,d1
jsr _LVOClose(a6) ; File schliessen
.quit tst.l d6 ; gepackt ?
beq.s .quit2
move.l gb_FileBuf(bp),a1 ; DeCrunch Puffer
lea 0(a1,d6.l),a0 ; EndCrunch
lea 16(a1),a1
move.l a1,gb_ModPtr(bp) ; richtiger Module-Ptr
addq.l #4,a2 ; DeCrunch-Bits
bsr PPDeCrunch ; auspacken
move.l a1,a2
bsr.s ModCheck ; prüfen
.quit2 move.l d7,d0 ; alles ok ?
beq.s .quit3 ; ja
move.l a3,a1
bsr PrintStr ; Fehler-Meldung ausgeben
move.l d7,d0 ; Fehler-Nr zurueckgeben
.quit3 movem.l (sp)+,d2-7/a2-3/a6
rts
ModCheck clr.w gb_ModDif(bp) ; loeschen
cmp.l #'M.K.',1080(a2)
beq.s chkok ; 31 Samples - NT oder PT
cmp.l #'FLT4',1080(a2)
beq.s chkok ; 31 Samples - StarTrekker
moveq #30,d2
clr.w gb_ModDif(bp)
bsr.s DoCheck ; Test auf 31 Samples
beq.s chkquit2 ; ist Modul
moveq #14,d2
move.w #480,gb_ModDif(bp) ; Test auf 15 Samples
DoCheck moveq #ModErr,d7 ; kein Module
lea 950(a2),a0 ; Zeiger auf SongLen
suba.w gb_ModDif(bp),a0
moveq #0,d0
move.b (a0)+,d0
beq.s chkquit ; SongLen == 0 - ungueltig !
bmi.s chkquit ; SongLen >127 - ungueltig !
move.b (a0)+,d1
beq.s chkquit ; CiaSpeed == 0 - ungueltig !
addq.b #1,d1
beq.s chkquit ; Speed == $ff - ungueltig !
move.b d0,d1
chkpattl cmp.b 0(a0,d0.w),d1 ; PatterListe pruefen
bcs.s chkquit ; PattNum > SongLen !
dbra d0,chkpattl
moveq #0,d1
lea 44(a2),a0 ; FineTune & Volume
chkvol1 moveq #15,d0
sub.b (a0)+,d0
bcs.s chkquit ; FineTune > 15 - ungueltig !
chkvol2 moveq #64,d0
sub.b (a0),d0
bcs.s chkquit ; Volume >64 - ungueltig !
add.b d0,d0
bmi.s chkvol3 ; Volume == 0 - nicht ok !
addq.b #1,d1
chkvol3 lea 29(a0),a0
dbra d2,chkvol1
subq.b #3,d1
bcs.s chkquit ; Zaehler < 3 - ungueltig !
chkok moveq #0,d7 ; vieleicht Modul !
chkquit move.l d7,d0 ; Flags stellen
chkquit2 rts
*****************************************************************************
DoCalc movem.l a2-3,-(sp) ; Regs sichern
tst.b gb_FlagLF(bp) ; LF noetig ?
beq.s .nolf
bsr.s PrintLF ; 1 x LF ausgeben
clr.b gb_FlagLF(bp) ; Flag loeschen
.nolf move.l gb_ModPtr(bp),a0 ; Header & Pattern
bsr CalcEffects ; Effekte zaehlen
movem.w d0-1,-(sp) ; SongLen & Pattern sichern
bsr MakeString ; Formatstring aufbauen
lea gb_StringBuf(bp),a0 ; Formatstring
lea gb_EfxTab(bp),a1 ; gezaehlte Effekte
bsr.s DoFormat ; Ausgabe aufbauen
move.l gb_ModPtr(bp),a0 ; Modulname kopieren
lea gb_PrintBuf+71(bp),a1 ; 2. Zeile
moveq #19,d0 ; max. 20 Zeichen oder bis
.copy move.b (a0)+,(a1)+ ; zum Null-Byte kopieren
dbeq d0,.copy
bne.s 1$ ; falls < 20
move.b #' ',-(a1) ; Null-Byte loeschen
1$ lea Patts.str(pc),a0
lea gb_PrintBuf+214(bp),a3 ; 4. Zeile
bsr.s FmtInfo ; Pattern eintragen
addq.l #2,sp
lea SongLen.str(pc),a0
lea gb_PrintBuf+285(bp),a3 ; 5 Zeile
bsr.s FmtInfo ; Songlaenge eintragen
addq.l #2,sp
bsr.s Print ; String ausgeben
lea gb_EfxTab(bp),a1 ; E-Cmds ueberpruefen
move.w 28(a1),d1
beq.s .quit ; keine E-Cmds
lea gb_FxeTab(bp),a1 ; gezaehlte E-Cmds
cmp.w (a1),d1
beq.s .quit ; nur Filterkommandos
lea gb_StringBuf+71(bp),a0 ; Headerzeile auslassen
bsr.s DoFormat ; Ausgabe aufbauen
lea ECmds.str(pc),a0 ; ECmd-String dazu
lea gb_PrintBuf+14(bp),a1
moveq #5,d0
.copy2 move.b (a0)+,(a1)+ ; String kopieren
dbra d0,.copy2
bsr.s Print ; String ausgeben
.quit movem.l (sp)+,a2-3 ; Regs restaurieren
PrintLF move.w #$0a00,gb_PrintBuf(bp) ; LF ausgeben
bra.s Print
*****************************************************************************
FmtInfo lea 4(sp),a1 ; Addresse des Parameters
bsr.s DoFmt
1$ tst.b (a3)+ ; Stringende suchen
bne.s 1$
move.b #' ',-(a3) ; Null loeschen
rts
DoFormat lea gb_PrintBuf(bp),a3 ; Ausgabepuffer
DoFmt lea sc_put(pc),a2 ; Puffer-Routine
move.l gb_SysBase(bp),a6
jmp _LVORawDoFmt(a6) ; formatieren
sc_put move.b d0,(a3)+ ; Zeichen in den Puffer
rts
PrintStr st gb_FlagLF(bp)
PrintStr2 lea StringTab(pc),a0 ; StringTabelle
add.w d0,d0
add.w 0(a0,d0.w),a0 ; Offset dazu
move.l a1,-(sp)
move.l sp,a1 ; Zeiger auf den Zeiger
bsr.s DoFormat ; in den Ausgabepuffer
addq.l #4,sp ; Stack aufraeumen
Print movem.l d2-3/a6,-(sp) ; Regs sichern
move.l gb_DosBase(bp),a6
jsr _LVOOutput(a6)
lea gb_PrintBuf(bp),a0
move.l a0,d2 ; Ausgabepuffer
moveq #-1,d3
.size tst.b (a0)+
dbeq d3,.size
not.l d3 ; Ausgabelaenge
jsr _LVOWrite(a6)
movem.l (sp)+,d2-3/a6 ; Regs zurueck
rts
*****************************************************************************
CalcEffects movem.l d2/a2,-(sp) ; Effekte bestimmen & zaehlen
moveq #0,d0
moveq #0,d1
moveq #127,d2
lea $3b8(a0),a0
suba.w gb_ModDif(bp),a0 ; 15/31 Samples
.cloop1 move.b (a0)+,d1 ; groesste PattNr suchen - D0
cmp.b d0,d1
bcs.s .cnext1
move.l d1,d0
.cnext1 dbra d2,.cloop1
move.b -130(a0),d1
movem.l d0-1,-(sp) ; PattNr & SongLen sichern
tst.w gb_ModDif(bp)
bne.s .not31
addq.l #4,a0 ; auf Patternanfang stellen
.not31 lea gb_FxeTab(bp),a1
moveq #15,d1
.clear clr.l (a1)+ ; Zaehler loeschen
dbra d1,.clear
lea gb_EfxTab(bp),a1 ; Effekte $0 - $F
lea gb_FxeTab(bp),a2 ; E-Cmds $0 - $F
.cloop2 move.w #255,d1 ; Patternlaenge 1024 Bytes
.cloop3 move.w 2(a0),d2
and.w #$0fff,d2
beq.s .cnext3 ; kein Effekt
lsr.w #8,d2 ; EffektNr ins Low-Byte
add.w d2,d2 ; Word-Offset
addq.w #1,0(a1,d2.w) ; Anzahl erhoehen
; bcs.s ende
cmp.w #28,d2 ; E-Cmd ?
bne.s .cnext3 ; nein
move.b 3(a0),d2 ; Effekt-Parameter
lsr.w #4,d2 ; E-Nr ins Low-Nibble
add.w d2,d2 ; Word-Offset
addq.w #1,0(a2,d2.w) ; Anzahl erhoehen
.cnext3 addq.l #4,a0 ; naechste Position
dbra d1,.cloop3
dbra d0,.cloop2 ; naechstes Pattern
movem.l (sp)+,d0-2/a2 ; PattNr,SongLen & d2/a2
rts
*****************************************************************************
MakeString movem.l d2/a2,-(sp) ; Formatstring aufbauen
lea gb_StringBuf(bp),a0 ; wohin
lea HexString.str(pc),a2 ; Effektnummer als ByteString
bsr.s PutStartEnd ; Kopfzeile
moveq #3,d2
.loop1 bsr.s PutSpaces ; 21 Leerzeichen
moveq #45,d1
lea Template.str(pc),a1 ; eine Zeile als Vorlage
.loop2 move.b (a1)+,d0 ; Nummernposition ?
bpl.s .next2
move.b (a2)+,d0 ; aktuelle Nr eintragen
.next2 move.b d0,(a0)+ ; Zeichen speichern
dbra d1,.loop2
dbra d2,.loop1
bsr.s PutStartEnd ; Fusszeile
clr.b (a0)
movem.l (sp)+,d2/a2
rts
PutStartEnd bsr.s PutSpaces ; 21 Spaces an den Anfang
moveq #48,d1
moveq #'-',d0
.loop move.b d0,(a0)+ ; 49 mal eintragen
dbra d1,.loop
move.b #10,(a0)+ ; LF als Abschluss
rts
PutSpaces moveq #20,d1
moveq #' ',d0
.loop move.b d0,(a0)+ ; 21 Spaces eintragen
dbra d1,.loop
rts
*****************************************************************************
; a1 - Zeiger in Kommandozeile
; d2 - argc
; a2 - argv
BuildArgV bsr.s GetNext ; Argument suchen
bmi.s doquote ; Quotierung
beq.s dosemi ; Kommentar beendet alles
bcs.s BuildArgV ; Trennzeichen
lea -1(a1),a0 ; Argumentanfang
bsr.s BumpArgV ; argc+1 & ptr nach argv
build_2 bsr.s GetNext ; Trennzeichen suchen
beq.s dosemi ; Kommentar beendet alles
bcc.s build_2 ; kein Trennzeichen
clr.b -1(a1) ; Ende kennzeichen
bra.s BuildArgV ; weiter machen
doquote move.l a1,a0 ; Argumentanfang
bsr.s BumpArgV ; argc+1 & ptr nach argv
quote_2 bsr.s GetNext ; Quotierung suchen
bpl.s quote_2 ; keine Quotierung
clr.b -1(a1) ; Ende kennzeichen
quote_3 bsr.s GetNext ; Trennzeichen suchen
beq.s dosemi ; Kommentar beendet alles
bcc.s quote_3 ; kein Trennzeichen
bra.s BuildArgV ; weiter machen
dosemi clr.b -(a1) ; Semikolon loeschen
bra.s BuildArgV
BumpArgV cmp.w #10,d2 ; max argc erreicht ?
bcc.s .full
move.l a0,(a2)+ ; argptr eintragen
addq.w #1,d2 ; argc+1
.full rts
GetNext move.b (a1)+,d0 ; Zeichen pruefen
beq.s BuildRdy
moveq #-3,d1 ; N=1,Z=0,C=0 -> Quote
cmp.b #'"',d0
beq.s .quit
moveq #-2,d1 ; N=0,Z=1,C=1 -> Semikolon
cmp.b #';',d0
beq.s .quit
moveq #-1,d1 ; N=0,Z=0,C=1 -> Trennzeichen
cmp.b #'=',d0
beq.s .quit
cmp.b #' ',d0
beq.s .quit
cmp.b #9,d0
beq.s .quit
moveq #0,d1 ; N=0,Z=0,C=0 -> Rest
.quit addq.l #2,d1 ; Flags stellen (siehe oben)
rts
BuildRdy addq.l #4,sp ; richtige Adresse einstellen
rts
*****************************************************************************
; PowerPacker assembler decrunch-subroutine
;
; PPDecrunch (endcrun, buffer, efficiency);
; a0 a1 a2
PPDeCrunch movem.l d0-7/a0-5,-(sp)
moveq #0,d4
moveq #1,d5
moveq #24,d6
move.w #255,d7
movea.l a1,a3
lea myDecrTab(pc),a4
lea $dff1a2,a5 ; DeCrunch Effekt
move.l -(a0),d1
tst.b d1
beq.s ppdecr_02
lsr.l #1,d5
beq.s ppdecr_10
ppdecr_01 subq.b #1,d1
lsr.l d1,d5
ppdecr_02 lsr.l #8,d1
adda.l d1,a1
ppdecr_03 lsr.l #1,d5
beq.s ppdecr_11
ppdecr_04 bcs ppdecr_21
moveq #0,d2
ppdecr_05 moveq #0,d1
lsr.l #1,d5
beq.s ppdecr_12
ppdecr_06 roxl.w #1,d1
lsr.l #1,d5
beq.s ppdecr_13
ppdecr_07 roxl.w #1,d1
add.w d1,d2
subq.w #3,d1
beq.s ppdecr_05
moveq #0,d0
ppdecr_08 move.b d5,d4
lsr.l #8,d5
beq.s ppdecr_16
ppdecr_09 move.b -128(a4,d4.w),d0
move.b d0,-(a1)
dbra d2,ppdecr_08
move.w a1,(a5)
cmpa.l a1,a3
bcs.s ppdecr_21
bra ppdecr_52
ppdecr_10 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_01
ppdecr_11 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_04
ppdecr_12 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_06
ppdecr_13 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_07
ppdecr_14 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_22
ppdecr_15 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_23
ppdecr_16 move.b 127(a4,d4.w),d0
move.l -(a0),d5
move.w d5,d3
lsl.w d0,d3
bchg d0,d3
eor.w d3,d4
and.w d7,d4
moveq #8,d1
sub.w d0,d1
lsr.l d1,d5
add.w d6,d0
bset d0,d5
bra.s ppdecr_09
ppdecr_17 move.b 127(a4,d4.w),d0
move.l -(a0),d5
move.w d5,d3
lsl.w d0,d3
bchg d0,d3
eor.w d3,d4
and.w d7,d4
moveq #8,d1
sub.w d0,d1
lsr.l d1,d5
add.w d6,d0
bset d0,d5
bra.s ppdecr_24
ppdecr_18 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_30
ppdecr_19 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_31
ppdecr_20 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_32
ppdecr_21 moveq #0,d2
lsr.l #1,d5
beq.s ppdecr_14
ppdecr_22 roxl.w #1,d2
lsr.l #1,d5
beq.s ppdecr_15
ppdecr_23 roxl.w #1,d2
move.b d5,d4
lsr.l #8,d5
beq.s ppdecr_17
ppdecr_24 moveq #0,d3
move.b -128(a4,d4.w),d3
cmp.w #3,d2
bne.s ppdecr_43
bclr #7,d3
beq.s ppdecr_36
moveq #13,d0
sub.b 0(a2,d2.w),d0
move.w d0,d1
add.w d0,d0
add.w d1,d0
add.w d0,d0
jmp ppdecr_28(pc,d0.w)
ppdecr_25 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_33
ppdecr_26 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_34
ppdecr_27 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_35
ppdecr_28 lsr.l #1,d5
beq.s ppdecr_18
ppdecr_30 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_19
ppdecr_31 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_20
ppdecr_32 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_25
ppdecr_33 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_26
ppdecr_34 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_27
ppdecr_35 roxl.w #1,d3
ppdecr_36 moveq #0,d1
lsr.l #1,d5
beq.s ppdecr_40
ppdecr_37 roxl.w #1,d1
lsr.l #1,d5
beq.s ppdecr_41
ppdecr_38 roxl.w #1,d1
lsr.l #1,d5
beq.s ppdecr_42
ppdecr_39 roxl.w #1,d1
add.w d1,d2
subq.w #7,d1
beq.s ppdecr_36
bra.s ppdecr_50
ppdecr_40 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_37
ppdecr_41 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_38
ppdecr_42 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_39
ppdecr_43 moveq #13,d0
sub.b 0(a2,d2.w),d0
move.w d0,d1
add.w d0,d0
add.w d1,d0
add.w d0,d0
jmp ppdecr_44(pc,d0.w)
ppdecr_44 lsr.l #1,d5
beq.s ppdecr_53
ppdecr_45 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_54
ppdecr_46 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_55
ppdecr_47 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_56
ppdecr_48 roxl.w #1,d3
lsr.l #1,d5
beq.s ppdecr_57
ppdecr_49 roxl.w #1,d3
ppdecr_50 move.b 0(a1,d3.w),-(a1)
ppdecr_51 move.b 0(a1,d3.w),-(a1)
dbra d2,ppdecr_51
move.w a1,(a5)
cmpa.l a1,a3
bcs ppdecr_03
ppdecr_52 movem.l (sp)+,d0-7/a0-5
rts
ppdecr_53 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_45
ppdecr_54 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_46
ppdecr_55 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_47
ppdecr_56 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_48
ppdecr_57 move.l -(a0),d5
roxr.l #1,d5
bra.s ppdecr_49
dc.b $00,$80,$40,$C0,$20,$A0,$60,$E0
dc.b $10,$90,$50,$D0,$30,$B0,$70,$F0
dc.b $08,$88,$48,$C8,$28,$A8,$68,$E8
dc.b $18,$98,$58,$D8,$38,$B8,$78,$F8
dc.b $04,$84,$44,$C4,$24,$A4,$64,$E4
dc.b $14,$94,$54,$D4,$34,$B4,$74,$F4
dc.b $0C,$8C,$4C,$CC,$2C,$AC,$6C,$EC
dc.b $1C,$9C,$5C,$DC,$3C,$BC,$7C,$FC
dc.b $02,$82,$42,$C2,$22,$A2,$62,$E2
dc.b $12,$92,$52,$D2,$32,$B2,$72,$F2
dc.b $0A,$8A,$4A,$CA,$2A,$AA,$6A,$EA
dc.b $1A,$9A,$5A,$DA,$3A,$BA,$7A,$FA
dc.b $06,$86,$46,$C6,$26,$A6,$66,$E6
dc.b $16,$96,$56,$D6,$36,$B6,$76,$F6
dc.b $0E,$8E,$4E,$CE,$2E,$AE,$6E,$EE
dc.b $1E,$9E,$5E,$DE,$3E,$BE,$7E,$FE
myDecrTab dc.b $01,$81,$41,$C1,$21,$A1,$61,$E1
dc.b $11,$91,$51,$D1,$31,$B1,$71,$F1
dc.b $09,$89,$49,$C9,$29,$A9,$69,$E9
dc.b $19,$99,$59,$D9,$39,$B9,$79,$F9
dc.b $05,$85,$45,$C5,$25,$A5,$65,$E5
dc.b $15,$95,$55,$D5,$35,$B5,$75,$F5
dc.b $0D,$8D,$4D,$CD,$2D,$AD,$6D,$ED
dc.b $1D,$9D,$5D,$DD,$3D,$BD,$7D,$FD
dc.b $03,$83,$43,$C3,$23,$A3,$63,$E3
dc.b $13,$93,$53,$D3,$33,$B3,$73,$F3
dc.b $0B,$8B,$4B,$CB,$2B,$AB,$6B,$EB
dc.b $1B,$9B,$5B,$DB,$3B,$BB,$7B,$FB
dc.b $07,$87,$47,$C7,$27,$A7,$67,$E7
dc.b $17,$97,$57,$D7,$37,$B7,$77,$F7
dc.b $0F,$8F,$4F,$CF,$2F,$AF,$6F,$EF
dc.b $1F,$9F,$5F,$DF,$3F,$BF,$7F,$FF
dc.b $00,$01,$01,$02,$02,$02,$02,$03
dc.b $03,$03,$03,$03,$03,$03,$03,$04
dc.b $04,$04,$04,$04,$04,$04,$04,$04
dc.b $04,$04,$04,$04,$04,$04,$04,$05
dc.b $05,$05,$05,$05,$05,$05,$05,$05
dc.b $05,$05,$05,$05,$05,$05,$05,$05
dc.b $05,$05,$05,$05,$05,$05,$05,$05
dc.b $05,$05,$05,$05,$05,$05,$05,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$06
dc.b $06,$06,$06,$06,$06,$06,$06,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$07
dc.b $07,$07,$07,$07,$07,$07,$07,$00
*****************************************************************************
StrCount set 0
StringTab ADDSTR PrgName
ADDSTR Usage
ADDSTR FileErr
ADDSTR ReadErr
ADDSTR ModErr
ADDSTR MemErr
ADDSTR Break
ADDSTR ReqNeed
ADDSTR LoadErr
ADDSTR Return
PrgName.str dc.b $9B,'3;33mModInfo 1.2',$9b,'0m © 1992'
dc.b ' by Gunther Nikl',10,10,0
even
Usage.str dc.b $9B,'1;31mUsage:',$9b,'0m ModInfo '
dc.b '[ File File ... ]',10
dc.b ' or',10,' ModInfo '
dc.b '[ -d Directory ]',10,0
even
FileErr.str dc.b '%s not found !',10,0
even
ReadErr.str dc.b '%s - read error !',10,0
even
ModErr.str dc.b '%s - not a st/nt/pt module !',10,0
even
MemErr.str dc.b 'not enough memory !',10,0
even
Break.str dc.b '***Break',10,0
even
ReqNeed.str dc.b 'no %s for filerequest !',10,0
even
LoadErr.str dc.b 'nothing selected !',10,0
even
Return.str dc.b 10,$9B,'0 p',$9B,'3;31mANY KEY TO QUIT !',$9b,'0m',0
even
Template.str dc.b '| $',$ff,' - %4d | $',$ff,' - %4d '
dc.b '| $',$ff,' - %4d | $',$ff,' - %4d |',10
even
HexString.str dc.b '0123456789ABCDEF'
even
ECmds.str dc.b 'e-cmds',0
even
Patts.str dc.b 'pattern: %3d',0
even
SongLen.str dc.b 'songlen: %3d',0
even
ReqTitle.str dc.b 'Load File(s) -> SHIFT for Multi Select',0
even
ConName.str dc.b 'RAW:0/10/640/150/ModInfo 1.2',0
even
DosName dc.b 'dos.library',0
even
ReqName dc.b 'req.library',0
even